home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 46
/
Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso
/
-in_the_mag-
/
reader_requests
/
pdflib
/
hello.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-09-16
|
1KB
|
48 lines
/* hello.c
* Copyright (C) 1997-98 Thomas Merz. All rights reserved.
*
* PDFlib sample application
*/
#include <stdio.h>
#include "pdf.h"
#define FILENAME "hello.pdf"
#define FONTNAME "Helvetica-Bold"
#define FONTSIZE 24.0
void
main(int argc, char *argv[])
{
FILE *pdffile; /* PDF output file pointer */
PDF *p; /* pointer to the PDF structure */
PDF_info *info; /* pointer to document info block */
char *filename = FILENAME;
if (argc > 1)
filename = argv[1];
if ((pdffile = fopen(filename, WRITEMODE)) == NULL) {
fprintf(stderr, "Error: cannot open PDF file %s.\n", filename);
exit(2);
}
info = PDF_get_info(); /* get info block */
info->Creator = "hello.c"; /* and fill some */
info->Author = "Thomas Merz"; /* elements */
info->Title = "Hello, world!";
p = PDF_open(pdffile, info); /* open new PDF file */
PDF_begin_page(p, a4.width, a4.height); /* start a new page */
PDF_set_font(p, FONTNAME, FONTSIZE, winansi);
PDF_set_text_pos(p, 50, 700);
PDF_show(p, "Hello, world!");
PDF_end_page(p); /* close page */
PDF_close(p); /* close PDF document */
exit(0);
}